package com.bwie.utils;

import java.io.Serializable;

/**
 * @projectName: server-2211a-shop
 * @package: com.bwie.utils
 * @className: Result
 * @author: 杨珂
 * @description: TODO
 * @date: 2025/5/21 13:36
 * @version: 1.0
 */
public class Result implements Serializable {
    private int code;

    private String msg;

    private Object data;

    public static Result ok() {
        Result result = new Result();
        result.setCode(200);
        result.setMsg("操作成功");
        result.setData(null);

        return result;
    }

    public static Result error() {
        Result result = new Result();
        result.setCode(500);
        result.setMsg("操作失败");
        result.setData(null);

        return result;
    }

    public int getCode() {
        return code;
    }

    public Result setCode(int code) {
        this.code = code;
        return Result.this;
    }

    public String getMsg() {
        return msg;
    }

    public Result setMsg(String msg) {
        this.msg = msg;
        return Result.this;
    }

    public Object getData() {
        return data;
    }

    public Result setData(Object data) {
        this.data = data;
        return Result.this;
    }
}
